package com.newbingo.dto;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import com.newbingo.dao.imple.IAgentLogDao;
import com.newbingo.dto.imple.IAgentLogDto;
import com.newbingo.entity.Agent;
import com.newbingo.entity.AgentLog;
import com.newbingo.util.Pager;

public class AgentLogDto implements IAgentLogDto,Serializable {
	private IAgentLogDao agentLogDao;
	private Integer logId;
	private Date operateTime;
	private String contents;
	
	
	/* 
	 * 根据Dao分页查询方法进行DTO转换
	 */
	public Pager findByPage(int start,int limit,Integer uno){
		Pager agentLogDtos=new Pager();
		Pager agentLogs=agentLogDao.findByPage(start, limit, uno);
		agentLogDtos.setTotalSize(agentLogs.getTotalSize());
		List<AgentLog> logs=agentLogs.getData();
		if(logs!=null && logs.size()>0){
			for(AgentLog agentLog:logs){
				agentLogDtos.getData().add(changeToDto(agentLog));
			}
		}
		return agentLogDtos;
	}
	
	private AgentLogDto changeToDto(AgentLog agentLog){
		AgentLogDto agentLogDto=new AgentLogDto();
		agentLogDto.setLogId(agentLog.getLogId());
		agentLogDto.setOperateTime(agentLog.getOperateTime());
		agentLogDto.setContents(agentLog.getContents());
		return agentLogDto;
	}
	
	public Integer getLogId() {
		return logId;
	}
	public void setLogId(Integer logId) {
		this.logId = logId;
	}
	public Date getOperateTime() {
		return operateTime;
	}
	public void setOperateTime(Date operateTime) {
		this.operateTime = operateTime;
	}
	public String getContents() {
		return contents;
	}
	public void setContents(String contents) {
		this.contents = contents;
	}

	public IAgentLogDao getAgentLogDao() {
		return agentLogDao;
	}

	public void setAgentLogDao(IAgentLogDao agentLogDao) {
		this.agentLogDao = agentLogDao;
	}
	

}
